<template>
	<view class="">
	<view class="u-flex p20 pt30" style="background: #19291C;color: #C7F3D0;align-items: flex-end;">
			<span class="fz32 u-font-bold lh28 mr5">1350</span>积分
	</view>
	<view class="p12">
		<view class="">
			<u-tabs bar-width="120" active-color="#70B52C" :list="tabList" :is-scroll="false" :current="current" @change="change"></u-tabs>
		</view>
		<view v-if="current==0">
			<view class="u-flex u-f-jsb bm pt16 pb16" v-for="(item,index) in 10" :key="index">
				<view>
					<view class="fz14">每日签到得积分</view>
					<view class="fz12 c9 mt4">2024-07-15 14:00</view>
				</view>
				<view style="color: #70B52C;" class="fz20">+120.00</view>
			</view>
		</view>
		<view v-if="current==1" class="pt15">
				<view @click="toInfo(item)" class="bg-white brs5 mb20 p10" v-for="(item,index) in 5"
					:key="index" style="background: rgba(25,41,28,0.05);">
					<view class="u-flex" style="align-items: flex-start;">
						<image src="https://diy.cdevelopment.cn/admin-api/infra/file/18/get/ab081824ea7386018f60fae46571ef2336ae54c5f20022c486a9717e1564822b.png" style="width: 160rpx;height: 160rpx;" mode="aspectFill"></image>
						<view class="pl12 u-f1">
							<view class="fz14 u-flex u-f-jsb">
								大容量单肩休闲包
							</view>
							<view class="fz14 u-flex u-f-jsb u-font-bold mt20" style="color: #70B52C;;">
								1200积分
							</view>
						<view class="fz12 c9 mt5">
							2024-07-15 14:00
						</view>
							
						</view>
					</view>
			
			
			
			
				</view>
			
				
		</view>
	</view>
	</view>
</template>
<script>
	export default {
		data() {
			return {
				tabList: [{
					name: '积分明细'
				}, {
					name: '订单记录'
				}],
				current: 0,
				recharge_attention: [],
				recharge_quota: []
			};
		},
		computed: {},
		onShow() {
			this.initData()

		},
		methods: {
			change(e){
				this.current=e
			},
			initData() {

				this.$api.rechargeIndex({}, res => {
					if (res.status == 200) {
						this.recharge_quota = res.data.recharge_quota;
						this.recharge_attention = res.data.recharge_attention;
					}
				})

			},


			toCreated() {
				let item = this.recharge_quota[this.curIndex]
				let post = {
					from: 'weixin',
					price: item.price,
					rechar_id: item.id,
					type: 0,
				}
				this.$api.rechargeAdd(post, res => {
					if (res.status == 200) {


						let info = res.data.result.jsConfig
						// 唤起微信支付。
						uni.requestPayment({
							provider: 'wxpay',
							timeStamp: info.timestamp,
							nonceStr: info.nonceStr,
							package: info.package,
							signType: info.signType,
							paySign: info.paySign,
							success: (res) => {

								uni.showToast({
									title: '支付成功',
									duration: 2000
								});
								setTimeout(() => {
									uni.navigateBack()
								}, 2000)
							},
							fail: (err) => {}
						});
					} else {

						this.$common.errorToShow(res.msg)
					}
				})
			},
			toPage(url) {
				uni.navigateTo({
					url
				})
			}
		}
	};
</script>

<style lang="scss" scoped>
	page {
		background: #fff;
	}

	.module-card {
		background: url('https://diy.cdevelopment.cn/admin-api/infra/file/18/get/502a61a86bd6abe6545de8c5170f4bfc162d0b1993ddf1e96622e876df8eeb7e.png') no-repeat center;
		background-size: contain;
		width: 702rpx;
		height: 280rpx;
		margin: 0 auto;
	}

	.item {
		width: 33.33%;
		min-width: 33.33%;
		max-width: 33.33%;
		padding: 0 12rpx;
		margin-bottom: 30rpx;

		.item-content {
			display: flex;
			flex-direction: column;
			justify-content: center;
			height: 120rpx;
			background: #F4F4F4;
			border-radius: 15rpx;
			text-align: center;
		}

		&.on {
			.item-content {
				background: rgba(112, 181, 44, 0.1);
				border: 1px solid #70B52C;
				color: #70B52C;

				.c9 {
					color: #70B52C !important;

				}
			}
		}

	}

	.loginbtn {
		font-size: 28rpx;
		background: linear-gradient(99deg, #00ACEB 0%, #4AC7F1 91%);
		color: #fff;
		height: 96rpx;
		line-height: 96rpx;
		border-radius: 50rpx;
		// box-shadow: 0 5px 7px 0 #0CA43C;
	}
</style>